_package("caf.ui.form");

_import("alz.core.Animation");
_import("alz.mui.Component");

/**
 * 滚动条组件
 */
_class("Checkbox", Component, function(){
	this._init = function(id, text, dock,tabIndex){
		_super._init.call(this);
		this._id = id;
		this._text = text;
		this._dock = dock;
		this._tabIndex = tabIndex;
		this._ifChecked = false;
	};
	this.create = function(parent){
		var obj = this.createElement(parent, "div", "caf-form-checkbox");
		
		this.setParent(parent);
		this.setId(this._id);
		this.init(obj);
		return obj;
	};
	this.bind = function(obj, conf){
		this._id = conf.id;
		this._conf = conf;
		this.setParent(conf.parent);
		if(conf.id){
			this.setId(conf.id);
		}
		this.init(obj);
	};
	this.init = function(obj){
		_super.init.apply(this, arguments);
		this.addListener(this._self, "tap", this, "check");
	};
	this.dispose = function(){
		_super.dispose.apply(this);
	};
	this.check = function(){
		if(this._ifChecked) this._self.className="caf-form-checkbox";
		else this._self.className="caf-form-checkbox-act";
		this._ifChecked = !this._ifChecked;
	}
	
});